<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>招聘管理-后台管理系统</title>
<link rel="stylesheet" href="${rc.contextPath}/bootstrap/css/bootstrap.css" />
<link rel="stylesheet" href="${rc.contextPath}/zui/css/zui.css" />
<script type="text/javascript" src="${rc.contextPath}/js/jquery.1.10.1.min.js"></script>
<script type="text/javascript" src="${rc.contextPath}/js/jquery.lib.min.js"></script>
<script type="text/javascript" src="${rc.contextPath}/zui/js/zui.js"></script>
</head>
<body>
		<ul class="nav nav-tabs" id="adminTab">
			<li>
				<a href="index.html" data-togggle="tab">首页</a>
			</li>
			<li class="active">
				<a href="${rc.contextPath}/admin/enterprise_manage" data-togggle="tab">企业管理及审核</a>
			</li>
			<li>
				<a href="${rc.contextPath}/admin/forum_manage" data-togggle="tab">论坛管理</a>
			</li>
			<li>
				<a href="${rc.contextPath}/admin/message" data-togggle="tab">消息</a>
			</li>
			<li class="pull-right">
				<a href="#" class="dropdown-toggle" data-toggle="dropdown">
					<img src="../../img/leader_default.png" width="20px" />管理员<span class="caret"></span>
				</a>
				<ul class="dropdown-menu">
					<li>
						<a href="#">账号设置</a>
					</li>
					<li>
						<a href="#">退出</a>
					</li>
				</ul>
			</li>
		</ul>

		<!--  左侧菜单  -->
		<div style="margin-top: 20px;" class="col-xs-2">
			<nav class="menu" data-toggle="menu" style="width: 200px;">
				<ul class="nav nav-primary">

					<li class="active show nav-parent">
						<a href="javascript:;"><i class="icon icon-group"></i> 公司</a>
						<ul class="nav">
							<li>
								<a href="${rc.contextPath}/admin/enterprise_manage"><i class="icon icon-cog"></i> 公司信息管理</a>
							</li>
							<li>
								<a href="enterprise_check.html">
									<i class="icon icon-trophy"></i> 公司认证审核<span class="label label-badge pull-right">5</span>
								</a>
							</li>
							<li>
								<a href="${rc.contextPath}/admin/addcompany" ><i class="icon icon-plus"></i> 添加公司</a>
							</li>
						</ul>
					</li>

					<li class="active show nav-parent">
						<a href="javascript:;"><i class="icon icon-book"></i> 招聘</a>
						<ul class="nav">
							<li>
								<a href="${rc.contextPath}/admin/job_manage"><i class="icon icon-list-ul"></i> 招聘管理</a>
							</li>
							<li class="active">
								<a href="${rc.contextPath}/admin/addjob"><i class="icon icon-pencil"></i> 发布招聘</a>
							</li>
						</ul>
					</li>
				</ul>
			</nav>
		</div>
		
		<div class="col-xs-8" style="margin-top: 20px;">
			<form id="addjobForm" class="form-horizontal" action="#">
				<div class="panel">
					<div class="panel-header">
						<h4 class="panel-title">发布招聘信息</h4>
					</div>
					<div class="panel-body">
						<div class="form-group">
							<label for="exampleInputAccount4" class="col-sm-2">职位行业</label>
							<div class="col-md-6 col-sm-10">
								<select class="form-control" id="job_domain_id" name="job.job_domain_id">
									#foreach($!domain in $!domainList)
									<option value="$!domain.id">$!domain.domain_name</option>
									#end
								</select>
							</div>
						</div>
						<div class="form-group">
							<label for="exampleInputAccount4" class="col-sm-2">所属公司</label>
							<div class="col-md-6 col-sm-10">
								<input type="text" class="form-control" id="job_company_id" name="job.job_company_id" placeholder="请输入所属公司" />
							</div>
						</div>
						<div class="form-group">
							<label for="exampleInputAccount4" class="col-sm-2">职位名称</label>
							<div class="col-md-6 col-sm-10">
								<input type="text" class="form-control" id="job_name" name="job.job_name" placeholder="请输入职位名称"/>
							</div>
						</div>
						<div class="form-group">
							<label for="exampleInputAccount4" class="col-sm-2">所属部门</label>
							<div class="col-md-6 col-sm-10">
								<input type="text" class="form-control" id="job_department" name="job.job_department" placeholder="所属部门，可不填"/>
							</div>
						</div>
						<div class="form-group">
							<label for="exampleInputAccount4" class="col-sm-2">工作性质</label>
							<div class="col-md-6 col-sm-10">
								<select class="form-control" id="job_category" name="job.job_category">
									<option value="0">全职</option>
									<option value="1">兼职</option>
									<option value="2">实习</option>
								</select>
							</div>
						</div>
						<div class="form-group">
							<label for="exampleInputAccount4" class="col-sm-2">月薪范围</label>
							<div class="col-md-6 col-sm-10">
								<input type="number" class="form-control" id="job_salary_min" name="job.job_salary_min" placeholder="月薪下限"/>k
								~
								<input type="number" class="form-control" id="job_salary_max" name="job.job_salary_max" placeholder="月薪上限"/>k
							</div>
						</div>
						<div class="form-group">
							<label for="exampleInputAccount4" class="col-sm-2">工作城市</label>
							<div class="col-md-6 col-sm-10">
								<input type="number" class="form-control" id="job_location" name="job.job_location" placeholder="工作城市，例如：北京"/>
							</div>
						</div>
						<div class="form-group">
							<label for="exampleInputAccount4" class="col-sm-2">工作经验</label>
							<div class="col-md-6 col-sm-10">
								<select class="form-control" id="job_request_worktime" name="job.job_request_worktime">
									<option value="0">不限</option>
									<option value="1">应届毕业生</option>
									<option value="2">1年以下</option>
									<option value="3">1-3年</option>
									<option value="4">3-5年</option>
									<option value="5">5-10年</option>
									<option value="6">10年以上</option>
								</select>
							</div>
						</div>
						<div class="form-group">
							<label for="exampleInputAccount4" class="col-sm-2">学历要求</label>
							<div class="col-md-6 col-sm-10">
								<select class="form-control" id="job_request_edubackground" name="job.job_request_edubackground">
									<option value="0">不限</option>
									<option value="1">大专</option>
									<option value="2">本科</option>
									<option value="3">硕士</option>
									<option value="4">博士</option>
								</select>
							</div>
						</div>
						<div class="form-group">
							<label for="exampleInputAccount4" class="col-sm-2">职位诱惑</label>
							<div class="col-md-6 col-sm-10">
								<textarea  class="form-control" id="job_request_brief" name="job.job_request_brief" placeholder="请输入职位简介"></textarea>
							</div>
						</div>
						<div class="form-group">
							<label for="exampleInputAccount4" class="col-sm-2">职位详情描述</label>
							<div class="col-md-6 col-sm-10">
								<textarea  class="form-control" id="request_content" name="jobDetail.request_content" placeholder="请输入职位详情描述"></textarea>
							</div>
						</div>
						<div class="form-group">
							<label for="exampleInputAccount4" class="col-sm-2">接收简历邮箱</label>
							<div class="col-md-6 col-sm-10">
								<input type="email" class="form-control" id="job_receive_email" name="job.job_receive_email" placeholder="请输入职接收简历邮箱"/>
							</div>
						</div>
					</div>
					<div class="panel-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
						<button type="submit" class="btn btn-primary" id="tijiao">保存</button>
					</div>
				</div>
			</form>
		</div>

</body>

<script type="text/javascript">
$(document).ready(function(e) {
	
	//验证表单
	$("#addjobForm").validate({
		rules: {
			"job.job_name": {
				required:true
			},
			"job.job_company_id": {
				required:true
			},
			"job.job_domain_id": {
				required:true,
			},
			"job.job_location": {
				required:true
			},
			"job.job_request_worktime": {
				required:true
			},
			"job.job_request_edubackground": {
				required:true
			},
			"job.job_request_brief": {
				required:true
			},
			"jobDetail.request_content": {
				required:true
			},
			"job.job_category": {
				required:true
			},
			"job.job_salary_min": {
				required:true
			},
			"job.job_salary_max": {
				required:true
			},
			"job.job_receive_email": {
				required: true,
				email:true
			}
		},
		messages: {
			"job.job_name": {
				required:"请输入职位名称"
			},
			"job.job_company_id": {
				required:"请选择公司"
			},
			"job.job_domain_id": {
				required:"请选择行业"
			},
			"job.job_location": {
				required:"请选择地点"
			},
			"job.job_request_worktime": {
				required:"请选择工作经验"
			},
			"job.job_request_edubackground": {
				required:"请选择学历"
			},
			"job.job_request_brief": {
				required:"请输入职位简介"
			},
			"jobDetail.request_content": {
				required:"请输入职位详情"
			},
			"job.job_category": "请选择工作类型",
			"job.job_salary_min": "请输入月薪下限",
			"job.job_salary_max": "请输入月薪上限",
			"job.job_receive_email": {
				required: "请输入邮箱地址",
				email:"请输入正确的邮箱地址"
			}
		},
		errorPlacement: function(label, element) {
			if(element.attr("type") == "radio") {
				label.insertAfter($(element).parents('ul')).css('marginTop', '-20px');
			} else if(element.attr("type") == "checkbox") {
				label.insertAfter($(element).parent()).css('clear', 'left');
			} else {
				label.insertAfter(element);
			};
		},
		submitHandler: function(form) {


			/* $(form).find(":submit").attr("disabled", true); */
			jQuery.ajax({
            	url:'${rc.contextPath}/job/add',
            	dataType:'json',
            	type:'post',
            	data:$('#addjobForm').serialize(),
           		error:function(){
            	},
            	success:function(data){
            		if(data.code == 200){
    					(new jQuery.zui.ModalTrigger({
    						custom : "添加成功"
    					})).show({hidden: function(){
    						window.location.href = "${rc.contextPath}/admin/addjob";
    					}});
    				}else{
    					(new jQuery.zui.ModalTrigger({
    						custom : data.info
    					})).show();
    				}
            	}
            });
			/* jQuery.post("${rc.contextPath}/job/add", $("#addjobForm").serialize(), function(data) {
				if(data.code == 200){
					(new jQuery.zui.ModalTrigger({
						custom : "添加成功"
					})).show({hidden: function(){
						window.location.href = "${rc.contextPath}/admin/addjob";
					}});
				}else{
					(new jQuery.zui.ModalTrigger({
						custom : data.info
					})).show();
				}
				
			}, 'json'); */
			return false;
			
		} 
	});
});
</script>

</html>